
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QListWidgetItem>
#include <QMainWindow>
#include <QWidget>

QT_BEGIN_NAMESPACE
struct ItemKV {
    QString text;
    int index;
    bool blocked;
};
QT_END_NAMESPACE

class QFileSystemModel;
namespace Ui {
    class MainWindow;
}
class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    QString log() const;
    void setLog(const QString &newLog);

    void append_filter_item(QString text, int index = 0);
    QListWidgetItem *find_filter_item(QString text);

    void open_log_file(QString filePath);

    void remove_filter_item(QListWidgetItem *item = nullptr);

private slots:
    void on_lg_filter_add_clicked();

    void on_lg_filter_del_clicked();

    void on_lg_filter_create_clicked();

    void on_lg_log_paste_textChanged(const QString &arg1);

    void on_lg_log_editor_slider_actionTriggered(int action);

    void on_lg_log_editor_slider_valueChanged(int value);

    void on_lg_log_editor_wordwrap_stateChanged(int arg1);

private:
    QStringList lg_list_values();
    QList<ItemKV> lg_filter_list_kv();
    void updateLog(bool is_timer_call = false, int interval = 1000);

private slots:
    void slotStateChanged();

    void on_action_filter_gen_values_triggered();

    void on_lg_filter_clean_clicked();

    void on_lg_log_file_treeview_entered(const QModelIndex &index);

    void on_lg_log_file_treeview_clicked(const QModelIndex &index);

    void on_lg_filter_search_textChanged(const QString &arg1);

    void on_action_open_android_analyzer_triggered();

    void on_lg_pick_start_textChanged(const QString &arg1);
    void on_lg_pick_stop_textChanged(const QString &arg1);

    void on_lg_btn_open_clicked();

    void on_lg_log_editor_selectionChanged();

    void on_lg_comb_dictionary_currentTextChanged(const QString &arg1);

    void on_action_open_dictionary_triggered();

private:
    Ui::MainWindow *ui;
    QFileSystemModel *model;
    QString m_log;

    // QWidget interface
protected:
    void dragEnterEvent(QDragEnterEvent *event) override;
    void dropEvent(QDropEvent *event) override;
};

#endif // MAINWINDOW_H

